#include<iostream>

using namespace std;

class A
{
public: int i;
         A(){ p=0;i=0; cout<<"A::A(i)"<<endl;}
         ~A() { if(p) delete p;cout<<"A::~A()"<<endl;}
         void set(int i) {this ->i=i;}
         void f() {p=new int;}
         void g(A* q){cout<<"A::g(),q->i="<<q->i<<endl;}
private:
     
    void f(){cout<<"hello";}
};

int main ()
{
    A* p=new A[10];
    int i;

    for(int i=0;i<10;i++)
    {
        p[i].set(i);
        cout<<i<<endl;
    }
    

    A b;
    b.set(100);
    p[0].g(&b);
    delete[] p;


    cin>>i;
    return 0;
}